//
//  LSZAllDynamicListsManager.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/8/21.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZAllDynamicListsManager.h"

@implementation LSZAllDynamicListsManager
-(id)initWithAllDynamicLists :(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        if ([[dic valueForKey:@"data"] isKindOfClass:[NSString class]]) {
            return self;
        }
        if ([[dic valueForKey:@"data"] isKindOfClass:[NSNumber class]]) {
            return self;
        }
        if (![dic valueForKey:@"data"]) {
            return self;
        }
        NSArray * arrayData = dic[@"data"];
        NSMutableArray * AddArrayMg = [[NSMutableArray alloc]init];
        for (NSDictionary * diction in arrayData) {
            LSZAllDynamicListsMg * mg = [[LSZAllDynamicListsMg alloc]init];
            mg.id_id = NullStringjudgment(NSStr(diction[@"id"]));
            mg.content = NullStringjudgment(NSStr(diction[@"content"]));
            mg.theme_content = NullStringjudgment(NSStr(diction[@"theme_content"]));
            mg.title = NullStringjudgment(NSStr(diction[@"title"]));
            mg.admire_num = NullStringjudgment(NSStr(diction[@"admire_num"]));
            mg.kind = NullStringjudgment(NSStr(diction[@"kind"]));
            mg.kind_name = NullStringjudgment(NSStr(diction[@"kind_name"]));
            mg.video = NullStringjudgment(NSStr(diction[@"video"]));
            mg.is_follow = NullStringjudgment(NSStr(diction[@"is_follow"]));
            mg.type = NullStringjudgment(NSStr(diction[@"type"]));
            mg.comment_num = NullStringjudgment(NSStr(diction[@"comment_num"]));
            mg.uid = NullStringjudgment(NSStr(diction[@"uid"]));
            mg.add_time = NullStringjudgment(NSStr(diction[@"add_time"]));
            mg.view_num = NullStringjudgment(NSStr(diction[@"view_num"]));
            mg.avatar = NullStringjudgment(NSStr(diction[@"avatar"]));
            mg.theme = NullStringjudgment(NSStr(diction[@"theme"]));
            mg.resource = NullStringjudgment(NSStr(diction[@"resource"]));
            mg.is_admire = NullStringjudgment(NSStr(diction[@"is_admire"]));
            mg.username = NullStringjudgment(NSStr(diction[@"username"]));
            mg.gender = NullStringjudgment(NSStr(diction[@"gender"]));
            mg.city = NullStringjudgment(NSStr(diction[@"city"]));

            id images = diction[@"images"];
            if ([images isKindOfClass:[NSArray class]]) {
                mg.arrayImages = diction[@"images"];
            }else{
                mg.arrayImages = @[];
            }
            id resources = diction[@"resources"];
            if ([resources isKindOfClass:[NSDictionary class]]) {
                if([[diction allKeys] containsObject:@"resources"] ) {
                    NSDictionary * dicResources = diction[@"resources"];
                    mg.resources_id = NullStringjudgment(NSStr(dicResources[@"id"]));
                    if([[dicResources allKeys] containsObject:@"name"]){
                        mg.resources_name = NullStringjudgment(NSStr(dicResources[@"name"]));
                    }
                    if([[dicResources allKeys] containsObject:@"fileUrl"]){
                        mg.resources_fileUrl = NullStringjudgment(NSStr(dicResources[@"fileUrl"]));
                    }
                    if([[dicResources allKeys] containsObject:@"album_id"]){
                        mg.resources_album_id = NullStringjudgment(NSStr(dicResources[@"album_id"]));
                    }
                    if([[dicResources allKeys] containsObject:@"image"]){
                        mg.resources_image = NullStringjudgment(NSStr(dicResources[@"image"]));
                    }
                    if([[dicResources allKeys] containsObject:@"artist_name"]){
                        mg.resources_artist_name = NullStringjudgment(NSStr(dicResources[@"artist_name"]));
                    }
                    if([[dicResources allKeys] containsObject:@"author"]){
                        mg.resources_artist_name = NullStringjudgment(NSStr(dicResources[@"author"]));
                    }
                }
            }
            [AddArrayMg addObject:mg];
        }
        self.arrayData = AddArrayMg;
    }
    return self;
}
-(id)initWithDetailsOfTheNotificationInterface :(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        if ([[dic valueForKey:@"data"] isKindOfClass:[NSString class]]) {
            return self;
        }
        if ([[dic valueForKey:@"data"] isKindOfClass:[NSNumber class]]) {
            return self;
        }
        if (![dic valueForKey:@"data"]) {
            return self;
        }
        id dicData = dic[@"data"] ;
        if (![dicData isKindOfClass:[NSDictionary class]]) {
            return self;
        }
        NSMutableArray * AddArrayMg = [[NSMutableArray alloc]init];
        NSDictionary * diction = dic[@"data"];
        LSZAllDynamicListsMg * mg = [[LSZAllDynamicListsMg alloc]init];
        mg.id_id = NullStringjudgment(NSStr(diction[@"id"]));
        mg.content = NullStringjudgment(NSStr(diction[@"content"]));
        mg.theme_content = NullStringjudgment(NSStr(diction[@"theme_content"]));
        mg.title = NullStringjudgment(NSStr(diction[@"title"]));
        mg.admire_num = NullStringjudgment(NSStr(diction[@"admire_num"]));
        mg.kind = NullStringjudgment(NSStr(diction[@"kind"]));
        mg.kind_name = NullStringjudgment(NSStr(diction[@"kind_name"]));
        mg.video = NullStringjudgment(NSStr(diction[@"video"]));
        mg.is_follow = NullStringjudgment(NSStr(diction[@"is_follow"]));
        mg.type = NullStringjudgment(NSStr(diction[@"type"]));
        mg.comment_num = NullStringjudgment(NSStr(diction[@"comment_num"]));
        mg.uid = NullStringjudgment(NSStr(diction[@"uid"]));
        mg.add_time = NullStringjudgment(NSStr(diction[@"add_time"]));
        mg.view_num = NullStringjudgment(NSStr(diction[@"view_num"]));
        mg.avatar = NullStringjudgment(NSStr(diction[@"avatar"]));
        mg.theme = NullStringjudgment(NSStr(diction[@"theme"]));
        mg.resource = NullStringjudgment(NSStr(diction[@"resource"]));
        mg.is_admire = NullStringjudgment(NSStr(diction[@"is_admire"]));
        mg.username = NullStringjudgment(NSStr(diction[@"username"]));
        mg.gender = NullStringjudgment(NSStr(diction[@"gender"]));
        mg.city = NullStringjudgment(NSStr(diction[@"city"]));

        id images = diction[@"images"];
        if ([images isKindOfClass:[NSArray class]]) {
            mg.arrayImages = diction[@"images"];
        }else{
            mg.arrayImages = @[];
        }
        id resources = diction[@"resources"];
        if ([resources isKindOfClass:[NSDictionary class]]) {
            if([[diction allKeys] containsObject:@"resources"] ) {
                NSDictionary * dicResources = diction[@"resources"];
                mg.resources_id = NullStringjudgment(NSStr(dicResources[@"id"]));
                 if([[dicResources allKeys] containsObject:@"name"]){
                     mg.resources_name = NullStringjudgment(NSStr(dicResources[@"name"]));
                 }
                if([[dicResources allKeys] containsObject:@"fileUrl"]){
                    mg.resources_fileUrl = NullStringjudgment(NSStr(dicResources[@"fileUrl"]));
                }  if([[dicResources allKeys] containsObject:@"album_id"]){
                    mg.resources_album_id = NullStringjudgment(NSStr(dicResources[@"album_id"]));
                }  if([[dicResources allKeys] containsObject:@"image"]){
                    mg.resources_image = NullStringjudgment(NSStr(dicResources[@"image"]));
                }  if([[dicResources allKeys] containsObject:@"artist_name"]){
                    mg.resources_artist_name = NullStringjudgment(NSStr(dicResources[@"artist_name"]));
                }
                if([[dicResources allKeys] containsObject:@"author"]){
                    mg.resources_artist_name = NullStringjudgment(NSStr(dicResources[@"author"]));
                }
            }
        }
        [AddArrayMg addObject:mg];
        self.arrayData = AddArrayMg;
    }
    return self;
}
@end
@implementation LSZAllDynamicListsMg
@end
